<?php
namespace jy_jd;
defined('BY_JYA') or exit('error');
/*
	消息提醒
*/
class notice extends \plugin{
	public function notice_payorder($order){
		//酒店预订提交成功
		$template_id=cfc('account')->check_tpl_template('OPENTM401887054','jy_jd','酒店预订提交成功');
		$hotel=pdo_get('jy_jd_hotel',array('id'=>$order['hotelid']));
		$message=array(
			'first'=>array('value'=>'恭喜你，您的酒店预订已提交成功',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'订单编号','value'=>$order['order'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'酒店名称','value'=>$hotel['title'],"color" => "#4a5077"),
			'keyword3'=>array('title'=>'入住时间','value'=>$order['intime'],"color" => "#4a5077"),
			'keyword4'=>array('title'=>'下单金额','value'=>$order['fee'],"color" => "#4a5077"),
			'keyword5'=>array('title'=>'支付方式','value'=>$order['paytype'],"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/order/',true);
		}
		cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'payorder','jy_jd');
	}
	public function notice_payorder2admin($order){
		//酒店预订提交成功
		$template_id=cfc('account')->check_tpl_template('OPENTM401887054','jy_jd','酒店预订提交成功');
		$hotel=pdo_get('jy_jd_hotel',array('id'=>$order['hotelid']));
		if(!$hotel['msgmid']){
			return false;
		}
		$message=array(
			'first'=>array('value'=>'您有新的订单要处理，有客户预定了您的房间！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'订单编号','value'=>$order['order'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'酒店名称','value'=>$hotel['title'],"color" => "#4a5077"),
			'keyword3'=>array('title'=>'入住时间','value'=>$order['intime'],"color" => "#4a5077"),
			'keyword4'=>array('title'=>'下单金额','value'=>$order['fee'],"color" => "#4a5077"),
			'keyword5'=>array('title'=>'支付方式','value'=>$order['paytype'],"color" => "#4a5077"),
			'remark'=>array('value'=>'前往查看订单详情！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/manage.index/',true);
		}
		cfc('account')->sendtwoNotice($hotel['msgmid'],$template_id,$message,$url,'payorder2admin','jy_jd');
	}
	public function notice_querenorder($order){
		//酒店预订提交成功
		$template_id=cfc('account')->check_tpl_template('OPENTM401887054','jy_jd','酒店预订提交成功');
		$hotel=pdo_get('jy_jd_hotel',array('id'=>$order['hotelid']));
		$message=array(
			'first'=>array('value'=>'恭喜你，您的酒店预订已确认成功！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'订单编号','value'=>$order['order'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'酒店名称','value'=>$hotel['title'],"color" => "#4a5077"),
			'keyword3'=>array('title'=>'入住时间','value'=>$order['intime'],"color" => "#4a5077"),
			'keyword4'=>array('title'=>'下单金额','value'=>$order['fee'],"color" => "#4a5077"),
			'keyword5'=>array('title'=>'支付方式','value'=>$order['paytype'],"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/order/',true);
		}
		cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'payorder','jy_jd');
	}
	public function notice_ruzhu($order){
		//入住成功提醒
		$template_id=cfc('account')->check_tpl_template('OPENTM411640327','jy_jd','入住成功提醒');
		$message=array(
			'first'=>array('value'=>'入住酒店成功！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'用户姓名','value'=>$order['name'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'入住时间','value'=>date('Y-m-d H:i:s',time()),"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/order/',true);
		}
		cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'ruzhu','jy_jd');
	}
	public function notice_tuifang($order){
		//退房成功通知
		$template_id=cfc('account')->check_tpl_template('OPENTM406851576','jy_jd','退房成功通知');
		$room=pdo_get('jy_jd_room',array('id'=>$order['roomid']));
		$message=array(
			'first'=>array('value'=>'您好，你已成功退房！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'房间名称','value'=>$room['title'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'订单编号','value'=>$order['order'],"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/order/',true);
		}
		cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'ruzhu','jy_jd');
	}
	public function notice_receiveorder($order){
		//订单取消提醒
		$template_id=cfc('account')->check_tpl_template('OPENTM410432403','jy_jd','订单取消提醒');
		$hotel=pdo_get('jy_jd_hotel',array('id'=>$order['hotelid']));
		$message=array(
			'first'=>array('value'=>'尊敬的客户，您申请取消的订单已取消成功！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'酒店名称','value'=>$hotel['title'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'入住时间','value'=>$order['intime'],"color" => "#4a5077"),
			'keyword3'=>array('title'=>'客户姓名','value'=>$order['name'],"color" => "#4a5077"),
			'remark'=>array('value'=>'前往查看订单详情！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/order/',true);
		}
		cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'receiveorder','jy_jd');
	}
	public function notice_receiveorder2admin($order){
		//订单取消提醒
		$template_id=cfc('account')->check_tpl_template('OPENTM410432403','jy_jd','订单取消提醒');
		$hotel=pdo_get('jy_jd_hotel',array('id'=>$order['hotelid']));
		if(!$hotel['msgmid']){
			return false;
		}
		$message=array(
			'first'=>array('value'=>'尊敬的店长，您有申请取消的订单要处理！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'酒店名称','value'=>$hotel['title'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'入住时间','value'=>$order['intime'],"color" => "#4a5077"),
			'keyword3'=>array('title'=>'客户姓名','value'=>$order['name'],"color" => "#4a5077"),
			'remark'=>array('value'=>'前往查看订单详情！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_jd/manage.index/',true);
		}
		cfc('account')->sendtwoNotice($hotel['msgmid'],$template_id,$message,$url,'receiveorder2admin','jy_jd');
	}
}
